Skip to content

Introduce cluster support #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: cluster-support-feature-branch
Choose a base branch
from

Conversation

farost
Copy link
Member

@farost farost commented Jul 4, 2025

Usage and product changes

Implementation

flyingsilverfin and others added 10 commits July 18, 2025 19:50
## Usage and product changes

We generate specific error codes to check when executing commands and
scripts programmatically.
We now have the following exit codes:
```
  Success = 0,
  GeneralError = 1,
  CommandError = 2,
  ConnectionError = 3,
  UserInputError = 4,
  QueryError = 5,
```
## Usage and product changes
Update version, release notes, and dependencies.

## Implementation
…ing (typedb#302)

## Usage and product changes
Fix an incorrect requirement of `username` and `address` when executing
`console --version`. Additionally, unify the format of error messages
and add colors (e.g., the "error" header is printed in bold red and
argument references are printed in yellow, similar to some of the
existing parsing errors).

## Implementation
### --version
Make all CLI arguments optional. This requires handling `username` and
`address` manually, but it's the most scalable solution (in case we have
more arguments like `--version` that differ from the standard Console
flow).

Considered alternatives:
* use the standard Clap `--version` (not available for us because of the
version overriding mechanism, same as in `typedb` core);
* split CLI into subcommands to have a distinct difference between the
standard execution flow and other commands (I don't like it).

### Error messages
With this change, error messages became more random - some are colored,
while others are not. And this problem extended for specifically parsing
errors.

A less important loss: if both `username` and `address` are missing, we
will only notify about `username` first, and the `address` will be
mentioned only after the initial issue is fixed.

To compensate the stylistic mismatch, we introduce a better
user-friendly error messaging with coloring. Instead of manual coloring
with styling codes, we reuse [clap
structs](https://github.com/clap-rs/clap/blob/4c6fd932cb1860fac450dc7992918a5bde0c6a2b/clap_builder/src/builder/styling.rs#L62)
and formatting approach to make sure that it works consistently for all
error messages, for all operating systems, for all terminal operations
(e.g., redirecting output to a file).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants